package pl.edu.pw.MidEmu.Sensing.Processing;

import java.util.Dictionary;

import pl.edu.pw.MidEmu.Sensing.Values.IValue;

/**
 * Contains settings used by sensors value processing
 * @author Mateusz Starodab
 *
 */
public class ValueProcessing
{
	/**
	 * Contains possible value behaviour 
	 * @author Mateusz Starodab
	 */
	public enum ValueSpecification
	{
		/**
		 * Value will be decremented
		 */
		Decrement,
		/**
		 * Value will be read from external source
		 */
		External,
		/**
		 * Value will be incremented
		 */
		Increment,
		/**
		 * Value will be randomly generated
		 */
		Random,
		/**
		 * Value will be decremented in specified range
		 */
		RangeDecrement,
		/**
		 * Value will be incremented in specified range
		 */
		RangeIncrement,
		/**
		 * Value will be randomly generated in specified range
		 */
		RangeRandom
	}

	private IValue highLimit;

	private IValue lowLimit;

	private Dictionary<Integer, String> values;

	private ValueSpecification valueSpecification;
	
	/**
	 * Returns values read from external source
	 * @return Dictionary where key is line number and value is value reading 
	 */
	public Dictionary<Integer, String> getExternalValues()
	{
		return values;
	}

	/**
	 * When value operates in range mode gets high range limit
	 * @return High range limit
	 */
	public IValue getHighLimit()
	{
		return highLimit;
	}

	/**
	 * When value operates in range mode gets low range limit
	 * @return Low range limit
	 */
	public IValue getLowLimit()
	{
		return lowLimit;
	}

	/**
	 * Gets value specification
	 * @return Value specification
	 */
	public ValueSpecification getValueSpecification()
	{
		return valueSpecification;
	}

	/**
	 * Sets values read from external file
	 * @param externalValues dictionary with external values
	 */
	public void setExternalValues(Dictionary<Integer, String> externalValues)
	{
		values = externalValues;
	}

	/**
	 * Sets high limit
	 * @param highLimit High limit to be set
	 */
	public void setHighLimit(IValue highLimit)
	{
		this.highLimit = highLimit;
	}

	/**
	 * Sets low limit
	 * @param lowLimit Low limit to be set
	 */
	public void setLowLimit(IValue lowLimit)
	{
		this.lowLimit = lowLimit;
	}
	/**
	 * Sets value specification
	 * @param valueSpecification Value specification to be set
	 */
	public void setValueSpecification(ValueSpecification valueSpecification)
	{
		this.valueSpecification = valueSpecification;
	}
}